#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>

typedef struct map
{
    int index;
    int showTime;
}map;
int FirstNotRepeatingChar(char* str)
{
    map arr[52] = { 0 };
    int len = strlen(str);
    for (int i = 0; i < len; i++)
    {
        if (str[i] >= 'a' && str[i] <= 'z')
        {
            arr[str[i] - 'a'].showTime++;
            arr[str[i] - 'a'].index = i;
        }
        if (str[i] >= 'A' && str[i] <= 'Z')
        {
            arr[str[i] - 'A' + 26].showTime++;
            arr[str[i] - 'A' + 26].index = i;
        }
    }
    int min = _CRT_INT_MAX;
    for (int j = 0; j < 52; j++)
    {
        if (arr[j].showTime == 1)
        {
            if (min > arr[j].index)
            {
                min = arr[j].index;
            }        
        }
    }
    return min;
}
int main()
{
    char str[] = "google";
    int ret = FirstNotRepeatingChar(str);
    printf("%d\n", ret);
    return 0;
}